package pzl.com.strategypattern.beans;

import pzl.com.strategypattern.interfaces.IPriceStrategy;

/**
 * 价格类
 *
 * @author zl.peng
 * @version [1.0, 2016-11-02]
 */
public class Price {

    private IPriceStrategy priceStrategy;

    public Price(IPriceStrategy priceStrategy) {
        this.priceStrategy = priceStrategy;
    }

    public String getPrice(double price) {
        return String.format("%.2f", priceStrategy.calcPrice(price));
    }
}
